package day04;

import java.util.Scanner;

public class InvertedTriangle1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入几行");
        int n = scanner.nextInt();
        //正三角
        for (int i = 1; i <= n; i++) {
            for (int j = i; j <= n; j++) {//j代表空格 初始空格为n-1 依次减一
                System.out.print(" ");
            }
            for (int k = 1; k <= (2 * i - 1); k++) {//k代表*初始为i 依次加2
                System.out.print("*");
            }
            System.out.println();//换行
        }
        //倒三角

        for (int i = n - 1; i >= 1; i--) {
            for (int j = i; j <= n; j++) {
                System.out.print(" ");
            }
            for (int k = 1; k <= (2 * i - 1); k++) {
                System.out.print("*");
            }
            System.out.println();
        }

    }
}
